(deftemplate pcState
    (slot electricity(allowed-values TRUE FALSE))
    (slot keyboardPI(allowed-values TRUE FALSE))
    (slot mousePI(allowed-values TRUE FALSE))
    (slot CPUTemperature(type INTEGER))
    (slot strangePEEP(allowed-values TRUE FALSE))
    (slot rebootsPerHour(type INTEGER))
    (slot noStart(allowed-values TRUE FALSE))
    (slot monitor)
)

(defrule brokenRAM(pcState(electricity TRUE)(strangePEEP TRUE)(monitor off)) => 
	(printout t "Broken RAM! " crlf) )

(defrule unpluged(pcState(electricity TRUE)(keyboardPI FALSE)(monitor on)) => 
	(printout t "Keyboard unplugged!" crlf))

(defrule motherboard (pcState(electricity TRUE){rebootsPerHour > 0}(monitor on)) => 
	((System.out) println "Broken motherboard"))

(defrule off (declare (salience 2))(pcState(noStart FALSE)) => 
	((System.out) println "Power cable unplugged! "))

(defrule off1 (declare(salience 2))(pcState(noStart FALSE)) => 
	((System.out) println "Might be RAM memory! "))

(assert (pcState(electricity TRUE)(strangePEEP TRUE)(monitor off)(keyboardPI TRUE)(mousePI TRUE)(rebootsPerHour 0)(noStart FALSE)))
(assert (pcState(electricity TRUE)(strangePEEP FALSE)(monitor on)(keyboardPI FALSE)(mousePI TRUE)(rebootsPerHour 0)(noStart FALSE)))
(assert (pcState(electricity TRUE)(strangePEEP FALSE)(monitor on)(keyboardPI TRUE)(mousePI TRUE)(rebootsPerHour 5)(noStart TRUE)))


(run)